package addon.simplylock.theme.example;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

/**	Simply Lockscreen Skin Developer Kit
 * 
 *	Copyright (C) 2011  Jorge Garrido Oval, alias: FireZenk
 *
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>
**/

/** DONT MODIFY THIS CODE **/
public class Theme extends Activity {
	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lockscreen);
        new ExtractTask().execute("now");
        Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/digital.ttf");
        TextView granReloj = (TextView) findViewById(R.id.granReloj);
        granReloj.setTypeface(tf);
    }
    
    private class ExtractTask extends AsyncTask<String, Void, Object> {

		@Override
		protected String doInBackground(String... args) {
			try {
				new ListOfImages(getResources());
			} catch (Exception e) {
				e.printStackTrace();
			}
			return args[0];
		}

		@Override
		protected void onPostExecute(Object result) {
			super.onPostExecute(result);
			((RelativeLayout)findViewById(R.id.load)).setVisibility(View.INVISIBLE);
			Toast.makeText(Theme.this, "Theme successfully installed", Toast.LENGTH_LONG).show();
			Theme.this.onDestroy();
		}
	}
    
}